package site.wanjiahao;

import site.wanjiahao.list.LinkedList;
import site.wanjiahao.list.List;

// 队列使用双向链表实现
public class Queue<E> {

    private final List<E> list = new LinkedList<>();

    public int size() {
        return list.size();
    }

    public boolean isEmpty() {
        return list.isEmpty();
    }

    public void clear() {
        list.clear();
    }

    // 入队
    public void enQueue(E e) {
        list.add(e);
    }

    // 出队
    public E deQueue() {
        return list.remove(0);
    }

    // 获取对头元素
    public E front() {
        return list.get(0);
    }
}
